﻿<div ms-controller="INFO">
    <div class="sui-form form-horizontal">
        <div class="control-group">
            <label class="control-label" style="width:120px;">设备检测周期：</label>
            <div class="controls">
                <input class="input-xlarge input-xfat" placeholder="秒" type='text' ms-duplex="modelData.CallTime" />
                <span class="sui-label label-success">秒</span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" style="width:120px;">设备检测状态：</label>
            <div class="controls">
                <select class="input-large input-xfat" ms-duplex="modelData.CallFlag">
                    <option value="0">否</option>
                    <option value="1">是</option>
                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" style="width:120px;">自动备份周期：</label>
            <div class="controls">
                <input class="input-xlarge input-xfat" placeholder="周" type='text' ms-duplex="modelData.BackupTime" />
                <span class="sui-label label-success">周</span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" style="width:120px;">历史数据保留周期：</label>
            <div class="controls">
                <input class="input-xlarge input-xfat" placeholder="周" type='text' ms-duplex="modelData.ClearTime" />
                <span class="sui-label label-success">周</span>
            </div>
        </div>
        <div class="control-group" style="padding-top:20px;">
            <label class="control-label" style="width:120px;"></label>
            <div class="controls">
                <a href="javascript:void(0);" class="sui-btn btn-xlarge btn-primary" ms-click="SaveData()">保存</a>
            </div>
              
            </div>

    </div>
</div>

   
<script type="text/javascript">

    

    var tempmodel = avalon.define({
        $id: "INFO",
        authData: [],
        modelData: { "ID": "1", "CallTime": "5", "BackupTime": "1", "ClearTime": "8", "CallFlag": "0" },
        inittemp: function (strId) {
            ComFunJS.getJSON("BASE_GETCONFIG", function (r) {
                if (!tempmodel.modelData.CallFlag) {
                    tempmodel.modelData.CallFlag = "0";
                }
                tempmodel.modelData = r.result;
            });
            
        },
        SaveData: function (dom, formtype, status) {

            ComFunJS.postJSON("BASE_SETCONFIG", { P1: JSON.stringify(tempmodel.modelData.$model) }, function (r) {
                if (r.error == "") {
                    top.ComFunJS.winShowMsg("操作成功");

                    top.ComFunJS.close();

                } else {
                    top.ComFunJS.winShowAlert(r.error);
                }
            })
        }


    })

    avalon.ready(function () {

        tempmodel.inittemp();

    })

</script>

